import Vue from 'vue'
import Router from 'vue-router'
import { sync } from 'vuex-router-sync'
import App from '@/App.vue'
import store from '@/store'
import index from '../index.vue'
import '@/utils/vant'
import '@/utils/jump'
import '@/utils/dzShop'
import '@/styles/index.scss' // global css
// 自定义loading
import LoadingWrap from '@/components/Loading/index'
/* Layout */
import Layout from '@/views/layout/Layout'

Vue.use(LoadingWrap)
Vue.use(Router)

//图片的懒加载
import VueLazyLoad from 'vue-lazyload'
Vue.use(VueLazyLoad,{
    loading:'https://img.wifenxiao.com/h5-wfx/images/public/imgLoading.png',
    error:'https://img.wifenxiao.com/h5-wfx/images/public/imgError.jpg'
})

Vue.prototype.$Bus = new Vue()

const router = new Router({
  mode: 'history',
  routes: [{
    path: '/',
    component: Layout,
    children:[{
      path: 'privacyAgreement',
      name: 'privacyAgreement',
      component: index,
      meta: { 
        title: '隐私协议',
        noNavbar: true,
        noPublicBottom: true,
        noSideWidget: true
      }
    }],
    
  }],
})

export default function createApp() {
  const container = document.createElement('div')
  container.id = 'app'
  document.body.appendChild(container)

  document.documentElement.style.backgroundColor = '#f7f7f7'

  Vue.config.productionTip = false

  sync(store, router)

  return new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
  })
}
